use thiserror::Error as ErrorTrait;

mod node;

mod dht_impl;

mod dht;

#[derive(Debug, ErrorTrait)]
pub enum Error {}

pub type Result<T> = std::result::Result<T, Error>;

pub struct EndpointBuilder {
    domain_identity: DomainIdentity,
    endpoint_identity: EndpointIdentity,
}

#[derive(Clone)]
pub struct DomainIdentity {}

impl DomainIdentity {
    pub fn new() -> Self {
        todo!()
    }
}

#[derive(Clone)]
pub struct EndpointIdentity {}

impl EndpointIdentity {
    pub fn new() -> Self {
        todo!()
    }
}

#[derive(Clone)]
pub struct EndpointAddr {}

impl EndpointAddr {
    pub fn new() -> Self {
        todo!()
    }
}

impl EndpointBuilder {
    pub fn new(domain_identity: &DomainIdentity, endpoint_identity: &EndpointIdentity) -> Self {
        Self {
            domain_identity: domain_identity.clone(),
            endpoint_identity: endpoint_identity.clone(),
        }
    }

    pub fn build(self, bind_addr: &EndpointAddr) -> Endpoint {
        todo!()
    }
}

pub struct Endpoint {}

impl Endpoint {
    pub async fn bootstrap_node(
        &self,
        node_id: NodeId,
        booststrap_node_addr: &EndpointAddr,
    ) -> Result<Node> {
        todo!()
    }

    pub async fn bootstrap_root_node(&self, node_id: NodeId) -> Result<Node> {
        todo!()
    }
}

pub type Node = node::Node;

pub type NodeId = node::NodeId;
